package com.audaque.jadmin.system.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.audaque.jadmin.common.action.BaseAction;
import com.audaque.jadmin.system.model.Resource;
import com.audaque.jadmin.system.service.ResourceService;

/**
 * @Description :
 * @FileName: ResourceAction.java
 * @Author :WeiHui.Zhang
 * @Data : 2015年10月26日 下午4:23:31
 * @Version:V1.00
 */
@Controller
@RequestMapping(ResourceAction.PATH)
public class ResourceAction extends BaseAction {

	protected final static String PATH = "system/resource";

	@Autowired
	private ResourceService resourceService;

	@Override
	protected String getJspPathPrefix() {
		return PATH;
	}

	@RequestMapping("/json")
	@ResponseBody
	public List<Resource> getResources(HttpServletRequest request) {

		Integer userId = getCurrentShiroUser().getId();

		return resourceService.queryByUserId(userId);
	}

}
